%run preparation.py
%matplotlib inline
columns = ['time', 'x_tip', 'y_tip']
df_load = pd.read_csv('TipXY_A001_r0.1.txt', names=columns, delim_whitespace=True)
df_nice = df_load.drop(['time'], axis=1)
df = df_nice.iloc[0::10, :]
df.to_csv('SkippedTipXY_A001.csv', encoding='utf-8', index=False)
Dx_tip = np.diff(df['x_tip']); Dy_tip = np.diff(df['y_tip'])
DD=np.sqrt((Dx_tip**2)+(Dy_tip**2))
np.savetxt('DD_A001.csv', DD, delimiter=',')
v=DD/(10*dt); Av_vel = np.mean(v)
np.savetxt('v.csv', v, delimiter=',')
vSD=np.sum(((v-Av_vel)**2)/(np.size(v)-1)); vSD=np.sqrt(vSD)
plt.figure(figsize=(10,8))
#plt.text(6, 8, 'Av_Vel = ', fontdict=font); plt.text(8, 8, '%.5f'%Av_vel, fontdict=font)
#plt.text(6, 7, 'Vel_SD = ', fontdict=font); plt.text(8, 7, '%.5f'%vSD, fontdict=font)
plt.plot(df['x_tip'],df['y_tip'], label='Leading tip', color='green', marker='o', linestyle='dashed', linewidth=2, markersize=7)
plt.xlabel('X', fontdict=font); plt.ylabel('Y', fontdict=font)
plt.title('Actin Filament Grinding'); plt.legend(loc='upper left'); plt.grid()
#plt.savefig('actin_graph.svg', format='svg', dpi=1200)
print('Ave_vel: ', Av_vel)
print('VSD: ', vSD)
index_diff01 = np.diff(df01.index) # difference in index between one row and next
Dx = np.diff(df01['x']); Dy = np.diff(df01['y']) # value difference between one row and next
DD=np.sqrt((Dx**2)+(Dy**2)) # calculate distance
v=DD/(index_diff01*dt); Av_vel = np.mean(v) # calculate velocity and mean
vSD=np.sum(((v-Av_vel)**2)/(np.size(v)-1)); vSD=np.sqrt(vSD) # calculate standard deviation
plt.figure(figsize=(10,8))
plt.plot(df01['x'],df01['y'], label='Leading tip', color='green', marker='o', linestyle='dashed', linewidth=2, markersize=7)
plt.xlabel('X', fontdict=font); plt.ylabel('Y', fontdict=font)
plt.title('Actin Filament Grinding'); plt.legend(loc='upper left'); plt.grid()
print('Ave_vel: ', Av_vel)
print('VSD: ', vSD)
df01_ = df01.drop(df01.index[300]) # drop the last row to match vel shape
fig, ax1 = plt.subplots(dpi=500)
ax1.plot(df01_['time'],df01_['z'], 'b', label='Actin Z-variations')
ax1.axhline(df01_['z'].mean(), linestyle='--', linewidth=2, color='b', label='Average Z')
ax1.set_xlabel('Time (s)',fontdict=font)
ax1.set_ylabel('Z-Distance', color='b',fontdict=font)
ax1.tick_params('y', colors='b')
plt.legend(loc='upper left')
ax2 = ax1.twinx()
ax2.plot(df01_['time'],v, 'r', label='Tip velocity')
ax2.axhline(Av_vel, linestyle='--', linewidth=2, color='r', label='Average tip grinding velocity')
fig.set_size_inches([16, 10])
fig.tight_layout()
ax2.set_ylabel('Tip-Velocity', color='r',fontdict=font)
ax2.tick_params('y', colors='r')
plt.title('Actin Filament Grinding',fontdict=font); plt.legend(loc='upper right')
plt.grid(); plt.show()
fig = plt.figure(figsize=(14,10), dpi=500)
ax = fig.gca()
ax.set_xlabel('Height Z')
ax.set_ylabel('Occurrence')
df01['z'].hist(bins=100, ax=ax, color='green')
index_diff02 = np.diff(df02.index)
Dx = np.diff(df02['x']); Dy = np.diff(df02['y'])
DD=np.sqrt((Dx**2)+(Dy**2))
v=DD/(index_diff02*dt); Av_vel = np.mean(v)
vSD=np.sum(((v-Av_vel)**2)/(np.size(v)-1)); vSD=np.sqrt(vSD)
plt.figure(figsize=(10,8))
plt.plot(df02['x'],df02['y'], label='Leading tip', color='green', marker='o', linestyle='dashed', linewidth=2, markersize=7)
plt.xlabel('X', fontdict=font); plt.ylabel('Y', fontdict=font)
plt.title('Actin Filament Movement'); plt.legend(loc='upper left'); plt.grid()
print('Ave_vel: ', Av_vel)
print('VSD: ', vSD)
df02_ = df02.drop(df02.index[300])
fig, ax1 = plt.subplots(dpi=500)
ax1.plot(df02_['time'],df02_['z'], 'b', label='Actin Z-variations')
ax1.axhline(df02_['z'].mean(), linestyle='--', linewidth=2, color='b', label='Average Z')
ax1.set_xlabel('Time (s)',fontdict=font)
ax1.set_ylabel('Z-Distance', color='b',fontdict=font)
ax1.tick_params('y', colors='b')
plt.legend(loc='upper left')
ax2 = ax1.twinx()
ax2.plot(df02_['time'],v, 'r', label='Tip velocity')
ax2.axhline(Av_vel, linestyle='--', linewidth=2, color='r', label='Average tip grinding velocity')
fig.set_size_inches([16, 10])
fig.tight_layout()
ax2.set_ylabel('Tip-Velocity', color='r',fontdict=font)
ax2.tick_params('y', colors='r')
plt.title('Actin Filament Grinding',fontdict=font); plt.legend(loc='upper right')
plt.grid(); plt.show()
fig = plt.figure(figsize=(14,10), dpi=500)
ax = fig.gca()
ax.set_xlabel('Height Z')
ax.set_ylabel('Occurrence')
df02['z'].hist(bins=100, ax=ax, color='green')
index_diff03 = np.diff(df03.index)
Dx = np.diff(df03['x']); Dy = np.diff(df03['y'])
DD=np.sqrt((Dx**2)+(Dy**2))
v=DD/(index_diff03*dt); Av_vel = np.mean(v)
vSD=np.sum(((v-Av_vel)**2)/(np.size(v)-1)); vSD=np.sqrt(vSD)
plt.figure(figsize=(10,8))
plt.plot(df03['x'],df03['y'], label='Leading tip', color='green', marker='o', linestyle='dashed', linewidth=2, markersize=7)
plt.xlabel('X', fontdict=font); plt.ylabel('Y', fontdict=font)
plt.title('Actin Filament Movement'); plt.legend(loc='upper left'); plt.grid()
print('Ave_vel: ', Av_vel)
print('VSD: ', vSD)
df03_ = df03.drop(df03.index[40])
fig, ax1 = plt.subplots(dpi=500)
ax1.plot(df03_['time'],df03_['z'], 'b', label='Actin Z-variations')
ax1.axhline(df03_['z'].mean(), linestyle='--', linewidth=2, color='b', label='Average Z')
ax1.set_xlabel('Time (s)',fontdict=font)
ax1.set_ylabel('Z-Distance', color='b',fontdict=font)
ax1.tick_params('y', colors='b')
plt.legend(loc='upper left')
ax2 = ax1.twinx()
ax2.plot(df03_['time'],v, 'r', label='Tip velocity')
ax2.axhline(Av_vel, linestyle='--', linewidth=2, color='r', label='Average tip grinding velocity')
fig.set_size_inches([16, 10])
fig.tight_layout()
ax2.set_ylabel('Tip-Velocity', color='r',fontdict=font)
ax2.tick_params('y', colors='r')
plt.title('Actin Filament Grinding',fontdict=font); plt.legend(loc='upper right')
plt.grid(); plt.show()
fig = plt.figure(figsize=(14,10), dpi=500)
ax = fig.gca()
ax.set_xlabel('Height Z')
ax.set_ylabel('Occurrence')
df03['z'].hist(bins=100, ax=ax, color='green')
index_diff04 = np.diff(df04.index)
Dx = np.diff(df04['x']); Dy = np.diff(df04['y'])
DD=np.sqrt((Dx**2)+(Dy**2))
v=DD/(index_diff04*dt); Av_vel = np.mean(v)
vSD=np.sum(((v-Av_vel)**2)/(np.size(v)-1)); vSD=np.sqrt(vSD)
plt.figure(figsize=(10,8))
plt.plot(df04['x'],df04['y'], label='Leading tip', color='green', marker='o', linestyle='dashed', linewidth=2, markersize=7)
plt.xlabel('X', fontdict=font); plt.ylabel('Y', fontdict=font)
plt.title('Actin Filament Movement'); plt.legend(loc='upper left'); plt.grid()
print('Ave_vel: ', Av_vel)
print('VSD: ', vSD)
df04_ = df04.drop(df04.index[81])
fig, ax1 = plt.subplots(dpi=500)
ax1.plot(df04_['time'],df04_['z'], 'b', label='Actin Z-variations')
ax1.axhline(df04_['z'].mean(), linestyle='--', linewidth=2, color='b', label='Average Z')
ax1.set_xlabel('Time (s)',fontdict=font)
ax1.set_ylabel('Z-Distance', color='b',fontdict=font)
ax1.tick_params('y', colors='b')
plt.legend(loc='upper left')
ax2 = ax1.twinx()
ax2.plot(df04_['time'],v, 'r', label='Tip velocity')
ax2.axhline(Av_vel, linestyle='--', linewidth=2, color='r', label='Average tip grinding velocity')
fig.set_size_inches([16, 10])
fig.tight_layout()
ax2.set_ylabel('Tip-Velocity', color='r',fontdict=font)
ax2.tick_params('y', colors='r')
plt.title('Actin Filament Grinding',fontdict=font); plt.legend(loc='upper right')
plt.grid(); plt.show()
fig = plt.figure(figsize=(14,10), dpi=500)
ax = fig.gca()
ax.set_xlabel('Height Z')
ax.set_ylabel('Occurrence')
df04['z'].hist(bins=100, ax=ax, color='green')
index_diff05 = np.diff(df05.index)
Dx = np.diff(df05['x']); Dy = np.diff(df05['y'])
DD=np.sqrt((Dx**2)+(Dy**2))
v=DD/(index_diff05*dt); Av_vel = np.mean(v)
vSD=np.sum(((v-Av_vel)**2)/(np.size(v)-1)); vSD=np.sqrt(vSD)
plt.figure(figsize=(10,8))
plt.plot(df05['x'],df05['y'], label='Leading tip', color='green', marker='o', linestyle='dashed', linewidth=2, markersize=7)
plt.xlabel('X', fontdict=font); plt.ylabel('Y', fontdict=font)
plt.title('Actin Filament Movement'); plt.legend(loc='upper left'); plt.grid()
print('Ave_vel: ', Av_vel)
print('VSD: ', vSD)
df05_ = df05.drop(df05.index[43])
fig, ax1 = plt.subplots(dpi=500)
ax1.plot(df05_['time'],df05_['z'], 'b', label='Actin Z-variations')
ax1.axhline(df05_['z'].mean(), linestyle='--', linewidth=2, color='b', label='Average Z')
ax1.set_xlabel('Time (s)',fontdict=font)
ax1.set_ylabel('Z-Distance', color='b',fontdict=font)
ax1.tick_params('y', colors='b')
plt.legend(loc='upper left')
ax2 = ax1.twinx()
ax2.plot(df05_['time'],v, 'r', label='Tip velocity')
ax2.axhline(Av_vel, linestyle='--', linewidth=2, color='r', label='Average tip grinding velocity')
fig.set_size_inches([16, 10])
fig.tight_layout()
ax2.set_ylabel('Tip-Velocity', color='r',fontdict=font)
ax2.tick_params('y', colors='r')
plt.title('Actin Filament Grinding',fontdict=font); plt.legend(loc='upper right')
plt.grid(); plt.show()
fig = plt.figure(figsize=(14,10), dpi=500)
ax = fig.gca()
ax.set_xlabel('Height Z')
ax.set_ylabel('Occurrence')
df05['z'].hist(bins=100, ax=ax, color='green')
index_diff06 = np.diff(df06.index)
Dx = np.diff(df06['x']); Dy = np.diff(df06['y'])
DD=np.sqrt((Dx**2)+(Dy**2))
v=DD/(index_diff06*dt); Av_vel = np.mean(v)
vSD=np.sum(((v-Av_vel)**2)/(np.size(v)-1)); vSD=np.sqrt(vSD)
plt.figure(figsize=(10,8))
plt.plot(df06['x'],df06['y'], label='Leading tip', color='green', marker='o', linestyle='dashed', linewidth=2, markersize=7)
plt.xlabel('X', fontdict=font); plt.ylabel('Y', fontdict=font)
plt.title('Actin Filament Movement'); plt.legend(loc='upper left'); plt.grid()
print('Ave_vel: ', Av_vel)
print('VSD: ', vSD)
df06_ = df06.drop(df06.index[253])
fig, ax1 = plt.subplots(dpi=500)
ax1.plot(df06_['time'],df06_['z'], 'b', label='Actin Z-variations')
ax1.axhline(df06_['z'].mean(), linestyle='--', linewidth=2, color='b', label='Average Z')
ax1.set_xlabel('Time (s)',fontdict=font)
ax1.set_ylabel('Z-Distance', color='b',fontdict=font)
ax1.tick_params('y', colors='b')
plt.legend(loc='upper left')
ax2 = ax1.twinx()
ax2.plot(df06_['time'],v, 'r', label='Tip velocity')
ax2.axhline(Av_vel, linestyle='--', linewidth=2, color='r', label='Average tip grinding velocity')
fig.set_size_inches([16, 10])
fig.tight_layout()
ax2.set_ylabel('Tip-Velocity', color='r',fontdict=font)
ax2.tick_params('y', colors='r')
plt.title('Actin Filament Grinding',fontdict=font); plt.legend(loc='upper right')
plt.grid(); plt.show()
fig = plt.figure(figsize=(14,10), dpi=500)
ax = fig.gca()
ax.set_xlabel('Height Z')
ax.set_ylabel('Occurrence')
df06['z'].hist(bins=100, ax=ax, color='green')
index_diff07 = np.diff(df07.index)
Dx = np.diff(df07['x']); Dy = np.diff(df07['y'])
DD=np.sqrt((Dx**2)+(Dy**2))
v=DD/(index_diff07*dt); Av_vel = np.mean(v)
vSD=np.sum(((v-Av_vel)**2)/(np.size(v)-1)); vSD=np.sqrt(vSD)
plt.figure(figsize=(10,8))
plt.plot(df07['x'],df07['y'], label='Leading tip', color='green', marker='o', linestyle='dashed', linewidth=2, markersize=7)
plt.xlabel('X', fontdict=font); plt.ylabel('Y', fontdict=font)
plt.title('Actin Filament Movement'); plt.legend(loc='upper left'); plt.grid()
print('Ave_vel: ', Av_vel)
print('VSD: ', vSD)
df07_ = df07.drop(df07.index[290])
fig, ax1 = plt.subplots(dpi=500)
ax1.plot(df07_['time'],df07_['z'], 'b', label='Actin Z-variations')
ax1.axhline(df07_['z'].mean(), linestyle='--', linewidth=2, color='b', label='Average Z')
ax1.set_xlabel('Time (s)',fontdict=font)
ax1.set_ylabel('Z-Distance', color='b',fontdict=font)
ax1.tick_params('y', colors='b')
plt.legend(loc='upper left')
ax2 = ax1.twinx()
ax2.plot(df07_['time'],v, 'r', label='Tip velocity')
ax2.axhline(Av_vel, linestyle='--', linewidth=2, color='r', label='Average tip grinding velocity')
fig.set_size_inches([16, 10])
fig.tight_layout()
ax2.set_ylabel('Tip-Velocity', color='r',fontdict=font)
ax2.tick_params('y', colors='r')
plt.title('Actin Filament Grinding',fontdict=font); plt.legend(loc='upper right')
plt.grid(); plt.show()
fig = plt.figure(figsize=(14,10), dpi=500)
ax = fig.gca()
ax.set_xlabel('Height Z')
ax.set_ylabel('Occurrence')
df07['z'].hist(bins=100, ax=ax, color='green')
index_diff08 = np.diff(df08.index)
Dx = np.diff(df08['x']); Dy = np.diff(df08['y'])
DD=np.sqrt((Dx**2)+(Dy**2))
v=DD/(index_diff08*dt); Av_vel = np.mean(v)
vSD=np.sum(((v-Av_vel)**2)/(np.size(v)-1)); vSD=np.sqrt(vSD)
plt.figure(figsize=(10,8))
plt.plot(df08['x'],df08['y'], label='Leading tip', color='green', marker='o', linestyle='dashed', linewidth=2, markersize=7)
plt.xlabel('X', fontdict=font); plt.ylabel('Y', fontdict=font)
plt.title('Actin Filament Movement'); plt.legend(loc='upper left'); plt.grid()
print('Ave_vel: ', Av_vel)
print('VSD: ', vSD)
fig = plt.figure(figsize=(14,10), dpi=500)
ax = fig.gca()
ax.set_xlabel('Height Z')
ax.set_ylabel('Occurrence')
df07['z'].hist(bins=100, ax=ax, color='green')
df08_ = df08.drop(df08.index[292])
fig, ax1 = plt.subplots(dpi=500)
ax1.plot(df08_['time'],df08_['z'], 'b', label='Actin Z-variations')
ax1.axhline(df08_['z'].mean(), linestyle='--', linewidth=2, color='b', label='Average Z')
ax1.set_xlabel('Time (s)',fontdict=font)
ax1.set_ylabel('Z-Distance', color='b',fontdict=font)
ax1.tick_params('y', colors='b')
plt.legend(loc='upper left')
ax2 = ax1.twinx()
ax2.plot(df08_['time'],v, 'r', label='Tip velocity')
ax2.axhline(Av_vel, linestyle='--', linewidth=2, color='r', label='Average tip grinding velocity')
fig.set_size_inches([16, 10])
fig.tight_layout()
ax2.set_ylabel('Tip-Velocity', color='r',fontdict=font)
ax2.tick_params('y', colors='r')
plt.title('Actin Filament Grinding',fontdict=font); plt.legend(loc='upper right')
plt.grid(); plt.show()
fig = plt.figure(figsize=(14,10), dpi=500)
ax = fig.gca()
ax.set_xlabel('Height Z')
ax.set_ylabel('Occurrence')
df08['z'].hist(bins=100, ax=ax, color='green')
index_diff09 = np.diff(df09.index)
Dx = np.diff(df09['x']); Dy = np.diff(df09['y'])
DD=np.sqrt((Dx**2)+(Dy**2))
v=DD/(index_diff09*dt); Av_vel = np.mean(v)
vSD=np.sum(((v-Av_vel)**2)/(np.size(v)-1)); vSD=np.sqrt(vSD)
plt.figure(figsize=(10,8))
plt.plot(df09['x'],df09['y'], label='Leading tip', color='green', marker='o', linestyle='dashed', linewidth=2, markersize=7)
plt.xlabel('X', fontdict=font); plt.ylabel('Y', fontdict=font)
plt.title('Actin Filament Movement'); plt.legend(loc='upper left'); plt.grid()
print('Ave_vel: ', Av_vel)
print('VSD: ', vSD)
df09_ = df09.drop(df09.index[294])
fig, ax1 = plt.subplots(dpi=500)
ax1.plot(df09_['time'],df09_['z'], 'b', label='Actin Z-variations')
ax1.axhline(df09_['z'].mean(), linestyle='--', linewidth=2, color='b', label='Average Z')
ax1.set_xlabel('Time (s)',fontdict=font)
ax1.set_ylabel('Z-Distance', color='b',fontdict=font)
ax1.tick_params('y', colors='b')
plt.legend(loc='upper left')
ax2 = ax1.twinx()
ax2.plot(df09_['time'],v, 'r', label='Tip velocity')
ax2.axhline(Av_vel, linestyle='--', linewidth=2, color='r', label='Average tip grinding velocity')
fig.set_size_inches([16, 10])
fig.tight_layout()
ax2.set_ylabel('Tip-Velocity', color='r',fontdict=font)
ax2.tick_params('y', colors='r')
plt.title('Actin Filament Grinding',fontdict=font); plt.legend(loc='upper right')
plt.grid(); plt.show()
fig = plt.figure(figsize=(14,10), dpi=500)
ax = fig.gca()
ax.set_xlabel('Height Z')
ax.set_ylabel('Occurrence')
df09['z'].hist(bins=100, ax=ax, color='green')
index_diff10 = np.diff(df10.index)
Dx = np.diff(df10['x']); Dy = np.diff(df10['y'])
DD=np.sqrt((Dx**2)+(Dy**2))
v=DD/(index_diff10*dt); Av_vel = np.mean(v)
vSD=np.sum(((v-Av_vel)**2)/(np.size(v)-1)); vSD=np.sqrt(vSD)
plt.figure(figsize=(10,8))
plt.plot(df10['x'],df10['y'], label='Leading tip', color='green', marker='o', linestyle='dashed', linewidth=2, markersize=7)
plt.xlabel('X', fontdict=font); plt.ylabel('Y', fontdict=font)
plt.title('Actin Filament Movement'); plt.legend(loc='upper left'); plt.grid()
print('Ave_vel: ', Av_vel)
print('VSD: ', vSD)
df10_ = df10.drop(df10.index[297])
fig, ax1 = plt.subplots(dpi=500)
ax1.plot(df10_['time'],df10_['z'], 'b', label='Actin Z-variations')
ax1.axhline(df10_['z'].mean(), linestyle='--', linewidth=2, color='b', label='Average Z')
ax1.set_xlabel('Time (s)',fontdict=font)
ax1.set_ylabel('Z-Distance', color='b',fontdict=font)
ax1.tick_params('y', colors='b')
plt.legend(loc='upper left')
ax2 = ax1.twinx()
ax2.plot(df10_['time'],v, 'r', label='Tip velocity')
ax2.axhline(Av_vel, linestyle='--', linewidth=2, color='r', label='Average tip grinding velocity')
fig.set_size_inches([16, 10])
fig.tight_layout()
ax2.set_ylabel('Tip-Velocity', color='r',fontdict=font)
ax2.tick_params('y', colors='r')
plt.title('Actin Filament Grinding',fontdict=font); plt.legend(loc='upper right')
plt.grid(); plt.show()
fig = plt.figure(figsize=(14,10), dpi=500)
ax = fig.gca()
ax.set_xlabel('Height Z')
ax.set_ylabel('Occurrence')
df10['z'].hist(bins=100, ax=ax, color='green')